package com.xiaoyu.lanling.feature.serverpush

import `in`.srain.cube.request.JsonData
import com.xiaoyu.base.serverpush.event.ServerPushBaseEvent
import com.xiaoyu.base.serverpush.proxy.BaseServerEventProxy
import com.xiaoyu.lanling.feature.serverpush.event.*

class ServerPushFactoryProxy : BaseServerEventProxy() {

    override fun createServerPushEvent(jsonData: JsonData): ServerPushBaseEvent? {
        val key = jsonData.optString("key")

        return when (key) {
            "conversationListUpdate" -> ConversationListUpdatePush(jsonData)
            "checkIn" -> CheckInPush(jsonData)
            "cashPrize", "coinPrize" -> PrizePush(key, jsonData)
            "showVerifyDialog" -> ShowVerifyDialogPush(jsonData)
            "appUserUpdate" -> AppUserUpdatePush(jsonData)
            "appBasicUserUpdate" -> AppBasicUserUpdatePush(jsonData)
            "appVoiceUpdate" -> AppVoiceUpdatePush(jsonData)
            "relationshipUpdate" -> RelationshipUpdatePush(jsonData)
            "feedNoticeInfo" -> NewMomentNoticePush(jsonData)
            "charmingLevelUpdate" -> CharmingLevelUpPush(jsonData)
            "onTv" -> OnTVPush(jsonData)
            "freeMatchFinish" -> AVMatchFreeTimesFinishPush(jsonData)
            "generosityLevelUpdate" -> GenerosityLevelUpPush(jsonData)
            else -> null
        }
    }
}